package com.example.demo.entity;

import com.example.demo.enums.ErrCodeEnum;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;


/**
 * @ClassName: ResponseResult
 * @Description: ResponseResult
 * @Author: zzz
 * @Date: 2020-04-04 21:52
 */
@ApiModel(value = "返回模板")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult<T> {
    @ApiModelProperty(value = "状态码")
    private Integer error_code;
    @ApiModelProperty(value = "状态信息")
    private String msg;
    @ApiModelProperty(value = "数据模板")
    private T data;

    public ResponseResult() {
    }

    public ResponseResult(ErrCodeEnum errCodeEnum,
                          T data) {
        this.error_code = errCodeEnum.getCode();
        this.msg = errCodeEnum.getMessage();
        this.data = data;
    }

    public ResponseResult(Integer error_code,
                          String msg) {
        this.error_code = error_code;
        this.msg = msg;
    }


    public Integer getError_code() {
        return error_code;
    }

    public void setError_code(Integer error_code) {
        this.error_code = error_code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
